package org.simcore.serviceserver.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.jms.Queue;

/**
 * Created By Ray on 2017/9/20.
 */
@Slf4j
@Component
@EnableScheduling
public class Scheduler {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Queue archiveBufferQueue;

    @Scheduled(fixedDelay = 10000)
    public void run() {
        jmsMessagingTemplate.convertAndSend(archiveBufferQueue, "1");
    }
}
